package cn.wolfcode.crmspringboot.web.controller;

import cn.wolfcode.crmspringboot.domain.Title;
import cn.wolfcode.crmspringboot.query.QueryObject;
import cn.wolfcode.crmspringboot.service.impl.AuditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/audition")
public class AuditionController {
    @Autowired
    private AuditionService auditionService;

    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") QueryObject qo){
        model.addAttribute("result",auditionService.query(qo));
        return "audition/list";
    }


    @RequestMapping("/details")
    public String details(Model model,String id){
        Title title = auditionService.getDetails(id);
        model.addAttribute("result",title);
        return "audition/details";
    }
}
